package com.baozhun.mall.common.adapter

import com.baozhun.mall.common.R
import com.baozhun.mall.common.base.BaseListAdapter
import com.baozhun.mall.common.databinding.ItemCommonImgBinding
import com.baozhun.mall.common.BR
import com.baozhun.mall.common.base.BaseApplication
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import me.hgj.jetpackmvvm.ext.util.screenWidth

/**
 * @Title：功能图片适配器
 * @Description：
 * @Author：xuefeng.zhu
 * @Since：2022/11/10
 * @Version：1.0.0
 */
class CommonImgAdapter(data: MutableList<String>?, private val imageWidth: Int? = BaseApplication.mInstance.screenWidth) :
    BaseListAdapter<String, ItemCommonImgBinding>(R.layout.item_common_img, data) {

    override fun convert(holder: BaseDataBindingHolder<ItemCommonImgBinding>, item: String) {
        holder.dataBinding?.setVariable(BR.model, item)
        holder.dataBinding?.imageWidth = imageWidth
        holder.dataBinding?.executePendingBindings()
    }
}


